using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using XPStudio.DBTools.Sql;
using XPStudio.HR.Model;

namespace XPStudio.HR.DAL
{
    public class DepartmentDAL
    {
        public DepartmentDAL()
        {
        }

        #region Field 
        private const string FIELD_DEPID = "depid";
        private const string FIELD_DEPNAMECN = "depnamecn";
        private const string FIELD_DEPNAMEEN = "depnameen";
        private const string FIELD_DEPDESC = "depdesc";
        private const string FIELD_DEPPHONE = "depphone";
        private const string FIELD_PARENTDEPID = "parentdepid";
        private const string FIELD_ISROOT = "isroot";
        private const string FIELD_ISLEAF = "isleaf";
        private const string FIELD_DEPLEVEL = "deplevel";
        #endregion

        #region Parameter 
        private const string PARAM_DEPID = "@depid";
        private const string PARAM_DEPNAMECN = "@depnamecn";
        private const string PARAM_DEPNAMEEN = "@depnameen";
        private const string PARAM_DEPDESC = "@depdesc";
        private const string PARAM_DEPPHONE = "@depphone";
        private const string PARAM_PARENTDEPID = "@parentdepid";
        private const string PARAM_ISROOT = "@isroot";
        private const string PARAM_ISLEAF = "@isleaf";
        private const string PARAM_DEPLEVEL = "@deplevel";
        #endregion

        #region StoredProcedure
        private const string SP_ADD = "";
        private const string SP_DEL= "";
        private const string SP_UPDATE = "";
        private const string SP_GETALL = "";
        private const string SP_GETDEP = "";
        private const string SP_GETMEMBER = "";
        #endregion

        public void Add(DepartmentModel dep)
        {
            Database2 db = new Database2();
            SqlParameter[] parms ={
                db.MakeInParam(PARAM_DEPNAMECN, SqlDbType.NVarChar,50,dep.DepNameCN)
            };
            db.RunProc(SP_ADD, parms);
        }


    }
}
